package topofstack.networkserverutils.bean;

public class PingInfo {
	public int packetTransmitted;
	public int packetRecieved;
	public String time;

	public PingInfo(int packetTransmitted, int packetRecieved, String time) {
		this.packetTransmitted = packetTransmitted;
		this.packetRecieved = packetRecieved;
		this.time = time;
	}

	@Override
	public String toString() {
		int loss = 100 - packetRecieved * 100 / packetTransmitted;
		String str;
		
		if(loss == 0)
			str = "Success\n\n";
		else
			str = "Failure\n\n";
		str += "Packet Transmitted: " + packetTransmitted + "\n"
				+ "Packet Received: " + packetRecieved + "\n"
				+ "Packet Loss: " + loss + "% \n"
				+ "Time: " + time;
		
		return str;
	}

}
